.customer-container {
  padding: 20px;
  position: relative;
}

.customer-header {
  margin-bottom: 20px;
  position: relative;
  z-index: 9;
}

.customer-tabs {
  margin-bottom: 20px;
}

.basic-search-form {
  border-bottom: 1px solid transparent;
  transition: all 0.2s;
}

.basic-search-form.with-advanced {
  border-bottom-color: #dcdfe6;
}

.customer-content {
  margin-top: 20px;
  margin-bottom: 20px;
  position: relative;
  z-index: 5;
}

/* 高级搜索面板样式 */
.advanced-search-panel {
  width: 100%;
  background-color: #f5f7fa;
  border-radius: 0 0 4px 4px;
  padding: 20px;
  border: 1px solid #e4e7ed;
  border-top: none;
  margin-top: -1px;
  position: relative;
  z-index: 8;
  overflow: visible;
  min-height: 200px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dcdfe6;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: bold;
  color: #303133;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dcdfe6;
}

.panel-header span {
  font-size: 15px;
  font-weight: bold;
  color: #303133;
}

/* 过渡动画 */
.el-fade-in-linear-enter-active,
.el-fade-in-linear-leave-active {
  transition: all 0.2s linear;
}

.el-fade-in-linear-enter-from,
.el-fade-in-linear-leave-to {
  opacity: 0;
}

/* 高级搜索表单样式 */
:deep(.advanced-search-form) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 15px;
  width: 100%;
}

:deep(.advanced-search-form .form-item) {
  margin: 0;
  width: 100%;
}

:deep(.advanced-search-form .el-form-item__content) {
  width: 100%;
}

/* 特殊处理所在地区和合同金额表单项 */
:deep(.advanced-search-form .form-item[data-field='region']) {
  grid-column: span 2;
}

:deep(.advanced-search-form .form-item[data-field='amount']) {
  grid-column: span 2;
}

/* 操作按钮样式 */
:deep(.advanced-search-form .action-buttons) {
  grid-column: 1 / -1;
  margin: 10px 0 0 0;
  display: flex;
  justify-content: flex-end;
}

:deep(.advanced-search-form .action-buttons .el-form-item__content) {
  display: flex;
  justify-content: flex-end;
}

/* 过渡动画 */
.el-zoom-in-top-enter-active,
.el-zoom-in-top-leave-active {
  transition: all 0.3s cubic-bezier(0.55, 0, 0.1, 1);
}

.el-zoom-in-top-enter-from,
.el-zoom-in-top-leave-to {
  opacity: 0;
  transform: translate(-50%, -60%) scale(0.9);
}

.table-toolbar {
  margin-bottom: 15px;
  display: flex;
  gap: 10px;
}

.pagination-container {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* 表格状态样式 */
:deep(.el-tag--success) {
  background-color: #f0f9eb;
  border-color: #e1f3d8;
  color: #67c23a;
}

:deep(.el-tag--danger) {
  background-color: #fef0f0;
  border-color: #fde2e2;
  color: #f56c6c;
}

/* 按钮间距 */
.el-button + .el-dropdown {
  margin-left: 5px;
}

/* Tab样式 */
:deep(.el-tabs__nav-wrap::after) {
  height: 1px;
}

:deep(.el-tabs__active-bar) {
  height: 3px;
}

:deep(.el-tabs__item.is-active) {
  font-weight: bold;
}

/* 表格行样式 */
:deep(.el-table__row) {
  height: 50px;
}

/* 客户类型和地区字段样式 */
:deep(.el-tag--primary) {
  background-color: #ecf5ff;
  color: #409eff;
}

:deep(.el-tag--info) {
  background-color: #f4f4f5;
  color: #909399;
}

/* 组件宽度控制 */
:deep(.el-select) {
  width: 100%;
  display: block;
}

:deep(.customer-grade-selector),
:deep(.customer-source-selector) {
  width: 100% !important;
}

/* 地区级联选择器样式 */
:deep(.cascader-region) {
  width: 100%;
  min-width: 350px;
}

/* 地区选择器容器样式 */
.region-selector-container {
  display: flex;
  width: 100%;
  gap: 10px;
  flex-wrap: nowrap;
}

.region-selector-container .el-select {
  flex: 1;
}

/* 响应式处理 */
@media screen and (max-width: 768px) {
  .region-selector-container {
    flex-direction: column;
    gap: 10px;
  }

  .region-selector-container .el-select {
    width: 100%;
  }
}

/* 确保下拉菜单显示在最上层且不超出边界 */
:deep(.el-popper),
:deep(.el-select__popper),
:deep(.el-select-dropdown),
:deep(.el-picker__popper) {
  z-index: 10001 !important;
  max-height: 300px !important;
}

:deep(.el-select-dropdown__wrap) {
  max-height: 250px !important;
}

:deep(.el-select-dropdown__item) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 10px;
  height: 32px;
  line-height: 32px;
}

/* 日期选择器样式 */
:deep(.el-date-editor.el-input) {
  width: 220px;
}

:deep(.el-date-editor--daterange) {
  width: 260px;
}

/* 表格单元格文本截断样式 */
:deep(.el-table .cell) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 特别处理客户名称列，设置最大宽度 */
:deep(.el-table__body tr td:nth-child(4) .cell) {
  max-width: 200px;
}

/* 特别处理地址列，设置最大宽度 */
:deep(.el-table__body tr td:nth-child(13) .cell) {
  max-width: 200px;
}

/* 特别处理财务地址列，设置最大宽度 */
:deep(.el-descriptions__content) {
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 文本截断通用类 */
.text-ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  width: 100%;
}

/* 搜索区域样式 */
.amount-input-container {
  display: flex;
  align-items: center;
  width: 100%;
  flex-wrap: nowrap;
}

:deep(.el-input-number) {
  flex: 1;
  width: auto !important;
}

.mx-2 {
  width: 30px;
  text-align: center;
  flex-shrink: 0;
}

@media screen and (max-width: 992px) {
  .amount-input-container {
    flex-direction: row;
    gap: 5px;
  }
}

@media screen and (max-width: 480px) {
  .amount-input-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  :deep(.el-input-number) {
    width: 100% !important;
  }

  .mx-2 {
    width: 100%;
    margin: 5px 0;
    text-align: center;
  }
}

/* 调整输入框控件样式，避免重叠 */
:deep(.el-input-number .el-input__wrapper) {
  padding-left: 35px;
  padding-right: 35px;
  box-sizing: border-box;
}

:deep(.el-input-number .el-input__inner) {
  text-align: center;
  padding: 0 5px;
}

:deep(.el-input-number__decrease),
:deep(.el-input-number__increase) {
  z-index: 2;
  position: absolute;
  width: 32px;
  height: 100%;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
}

/* 调整按钮位置，确保不重叠 */
:deep(.el-input-number__decrease) {
  left: 1px;
}

:deep(.el-input-number__increase) {
  right: 1px;
}

/* 搜索按钮布局 */
.search-buttons {
  display: flex;
  justify-content: space-between;
  width: 100%;
  align-items: center;
}

.left-buttons {
  display: flex;
  gap: 10px;
}

.right-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* 高级搜索按钮布局 */
.advanced-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  width: 100%;
}

/* 表单标签样式 */
:deep(.el-form-item__label) {
  white-space: nowrap;
  padding-right: 12px;
}

:deep(.el-form-item) {
  margin-bottom: 18px;
}

:deep(.advanced-search-form .el-form-item) {
  margin-right: 15px;
}

/* 高级搜索面板响应式布局 */
@media screen and (max-width: 1400px) {
  :deep(.advanced-search-form) {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media screen and (max-width: 1200px) {
  :deep(.advanced-search-form) {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }

  :deep(.advanced-search-form .form-item[data-field='region']),
  :deep(.advanced-search-form .form-item[data-field='amount']) {
    grid-column: 1 / -1;
  }
}

@media screen and (max-width: 992px) {
  :deep(.advanced-search-form) {
    grid-template-columns: 1fr 1fr;
  }

  :deep(.advanced-search-form .form-item[data-field='region']),
  :deep(.advanced-search-form .form-item[data-field='amount']) {
    grid-column: span 2;
  }

  :deep(.el-form-item__label) {
    width: 90px !important;
  }

  :deep(.el-form-item__content) {
    margin-left: 90px !important;
  }
}

@media screen and (max-width: 768px) {
  :deep(.advanced-search-form) {
    grid-template-columns: 1fr;
  }

  :deep(.advanced-search-form .form-item) {
    grid-column: 1 / -1;
  }

  .advanced-search-panel {
    padding: 15px 10px;
  }

  :deep(.el-form-item__label) {
    width: 80px !important;
    padding-right: 5px;
    font-size: 14px;
  }

  :deep(.el-form-item__content) {
    margin-left: 80px !important;
  }

  :deep(.advanced-search-form .action-buttons .el-form-item__content) {
    margin-left: 0 !important;
  }
}

/* 客户添加抽屉样式 - 与系统风格保持一致 */
.customer-add-drawer {
  --el-drawer-width: 80%;
}

.customer-add-drawer :deep(.el-drawer__body) {
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 客户详情抽屉样式 */
.customer-detail-drawer {
  --el-drawer-width: 80%;
}

.customer-detail-drawer :deep(.el-drawer__body) {
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 客户编辑抽屉样式 */
.customer-edit-drawer {
  --el-drawer-width: 80%;
}

.customer-edit-drawer :deep(.el-drawer__body) {
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 自定义抽屉头部样式 */
.drawer-header {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* 绿色渐变背景 - 添加抽屉 */
.drawer-header.add-header {
  background: linear-gradient(to right, #67c23a, #85ce61, #9adb75);
  color: white;
}

/* 蓝色渐变背景 - 详情抽屉 */
.drawer-header.detail-header {
  background: linear-gradient(to right, #409eff, #66b1ff, #8cc5ff);
  color: white;
}

/* 橙色渐变背景 - 编辑抽屉 */
.drawer-header.edit-header {
  background: linear-gradient(to right, #e6a23c, #ebb563, #f3d19e);
  color: white;
}

.drawer-title {
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
}

.drawer-title .drawer-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  margin-right: 8px;
  font-size: 16px;
}

/* 关闭按钮样式优化 */
.drawer-close {
  cursor: pointer;
  font-size: 20px;
  color: white;
  transition: all 0.3s ease;
  padding: 5px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
}

.drawer-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.drawer-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

/* 抽屉底部按钮区域 */
.drawer-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  border-top: 1px solid #f0f0f0;
}

/* 新增客户抽屉按钮样式 - 绿色 */
.customer-add-drawer .drawer-footer .el-button--primary {
  background: linear-gradient(to right, #67c23a, #85ce61, #9adb75);
  border: none;
}

.customer-add-drawer .drawer-footer .el-button--primary:hover {
  background: linear-gradient(to right, #5daf34, #78c055, #8ed46a);
}

/* 客户详情抽屉按钮样式 - 蓝色 */
.customer-detail-drawer .drawer-footer .el-button--primary {
  background: linear-gradient(to right, #409eff, #66b1ff, #8cc5ff);
  border: none;
}

.customer-detail-drawer .drawer-footer .el-button--primary:hover {
  background: linear-gradient(to right, #3690ff, #4096ff, #7cb8ff);
}

/* 编辑客户抽屉按钮样式 - 橙色 */
.customer-edit-drawer .drawer-footer .el-button--primary {
  background: linear-gradient(to right, #e6a23c, #ebb563, #f3d19e);
  border: none;
}

.customer-edit-drawer .drawer-footer .el-button--primary:hover {
  background: linear-gradient(to right, #d9922b, #dfa545, #e9c086);
}
